#include <func.h>

void function(int signum)
{
    time_t now=time(NULL);
    printf("time:%s",ctime(&now));
}

int main()
{
    signal(SIGVTALRM,function);
    struct itimerval t;
    bzero(&t,sizeof(t));
    t.it_interval.tv_sec=3;
    t.it_value.tv_sec=2;
    function(0);
    int ret=setitimer(ITIMER_VIRTUAL,&t,NULL);
    ERROR_CHECK(ret,-1,"setitimer");
    sleep(2);
    while(1);
    return 0;
}